home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / plaf / basic / BasicTreeUI$TreeTraverseAction.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  2.3 KB  |  71 lines

  1. package javax.swing.plaf.basic;
  2.  
  3. import java.awt.event.ActionEvent;
  4. import javax.swing.AbstractAction;
  5. import javax.swing.tree.TreePath;
  6.  
  7. public class BasicTreeUI$TreeTraverseAction extends AbstractAction {
  8.    // $FF: synthetic field
  9.    private final BasicTreeUI this$0;
  10.    protected int direction;
  11.    private boolean changeSelection;
  12.  
  13.    public BasicTreeUI$TreeTraverseAction(BasicTreeUI var1, int var2, String var3) {
  14.       this(var1, var2, var3, true);
  15.    }
  16.  
  17.    private BasicTreeUI$TreeTraverseAction(BasicTreeUI var1, int var2, String var3, boolean var4) {
  18.       this.this$0 = var1;
  19.       this.direction = var2;
  20.       this.changeSelection = var4;
  21.    }
  22.  
  23.    // $FF: synthetic method
  24.    BasicTreeUI$TreeTraverseAction(BasicTreeUI var1, BasicTreeUI.1 var2, int var3, String var4, boolean var5) {
  25.       this(var1, var3, var4, var5);
  26.    }
  27.  
  28.    public void actionPerformed(ActionEvent var1) {
  29.       int var2;
  30.       if (this.this$0.tree != null && (var2 = this.this$0.getRowCount(this.this$0.tree)) > 0) {
  31.          int var3 = BasicTreeUI.access$5(this.this$0);
  32.          int var4;
  33.          if (var3 == -1) {
  34.             var4 = 0;
  35.          } else if (this.direction == 1) {
  36.             if (!this.this$0.isLeaf(var3) && !this.this$0.tree.isExpanded(var3)) {
  37.                this.this$0.toggleExpandState(this.this$0.getPathForRow(this.this$0.tree, var3));
  38.                var4 = -1;
  39.             } else {
  40.                var4 = Math.min(var3 + 1, var2 - 1);
  41.             }
  42.          } else if (!this.this$0.isLeaf(var3) && this.this$0.tree.isExpanded(var3)) {
  43.             this.this$0.toggleExpandState(this.this$0.getPathForRow(this.this$0.tree, var3));
  44.             var4 = -1;
  45.          } else {
  46.             TreePath var5 = this.this$0.getPathForRow(this.this$0.tree, var3);
  47.             if (var5 != null && var5.getPathCount() > 1) {
  48.                var4 = this.this$0.getRowForPath(this.this$0.tree, var5.getParentPath());
  49.             } else {
  50.                var4 = -1;
  51.             }
  52.          }
  53.  
  54.          if (var4 != -1) {
  55.             if (this.changeSelection) {
  56.                this.this$0.tree.setSelectionInterval(var4, var4);
  57.             } else {
  58.                BasicTreeUI.access$6(this.this$0, this.this$0.getPathForRow(this.this$0.tree, var4), true);
  59.             }
  60.  
  61.             this.this$0.ensureRowsAreVisible(var4, var4);
  62.          }
  63.       }
  64.  
  65.    }
  66.  
  67.    public boolean isEnabled() {
  68.       return this.this$0.tree != null && this.this$0.tree.isEnabled();
  69.    }
  70. }
  71.